Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 3 - Geometric Styles / Geometric Styles Reference
Functions / Getting and Setting the Pen Width


GXSetShapePen

You can use the GXSetShapePen function to change the pen width of the style object associated with a particular shape.

void GXSetShapePen(gxShape target, Fixed pen);
target
A reference to the shape whose pen width you want to change.
pen
The new pen width.
DESCRIPTION
The GXSetShapePen function sets the pen width of the target shape's style object to be the value specified in the pen parameter. You may specify any nonnegative value for this parameter.

If the target shape shares its style object with other shapes, this function makes a copy of the style object, sets the target shape to reference the copy, and changes the pen width of the copy. (However, if the effect of this function would leave the pen width information unchanged, this function does not create a copy of the style object; instead, it posts a notice.)

A pen width of 0 indicates a hairline; QuickDraw GX always draws hairlines one pixel wide.

GXSetShapePen(myShape, 0);  /* set as thin as renderable */
Remember that the pen parameter is specified as a fixed-point value. Very small diameters may cause all drawing to disappear, since a shape may fall between pixels. A common mistake when setting the pen width is to specify the pen width as an integer, rather than a fixed-point value:

GXSetStylePen(myStyle, 1);  /* set the pen width to 1/65536 */
GXSetStylePen(myStyle, ff(1));  /* set the pen width to 1.0 */
ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
parameter_out_of_range(debugging version)
Notices (debugging version) 
pen_size_already_set 
SEE ALSO
For a discussion of the drawing pen, see "The Geometric Pen" on page 3-15.

For an example of changing a shape's pen width, see "Manipulating Pen Width and Placement" on page 3-51.

To determine the pen width of a style object, use the GXGetStylePen function, which is described on page 3-119. To change the pen width of a style object, use the GXSetStylePen function, which is described on page 3-120.

To determine the pen width of a style object associated with a particular shape, use the GXGetShapePen function, which is described on page 3-121.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help